package xyz.o0o0o.demo.threadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Hello world!
 *
 */
public class App 
{
    public static ExecutorService executor =  Executors.newFixedThreadPool(2);
    public static void main( String[] args )
    {
        System.out.println( "begin" );
        executor.execute(new MyThread());
        executor.execute(new MyThread());
        executor.shutdown();
        System.out.println( "end" );
    }
    
    
}
 
class MyThread implements Runnable{

    public void run() {
        for (int i = 0; i <10; i++) {
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() +":"+i);
        }
    }
    
}